<?php
    session_start();
?>
<!-- InstanceBegin template="/Templates/admin_template.dwt.php" codeOutsideHTMLIsLocked="false" --><?php
	include("../Connect/connection.php")
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head>
<title>Admin page</title>

<!-- CSS -->
<link href="style/css/transdmin.css" rel="stylesheet" type="text/css" media="screen" />
<!--[if IE 6]><link rel="stylesheet" type="text/css" media="screen" href="style/css/ie6.css" /><![endif]-->
<!--[if IE 7]><link rel="stylesheet" type="text/css" media="screen" href="style/css/ie7.css" /><![endif]-->

<!-- JavaScripts-->
<script type="text/javascript" src="style/js/jquery.js"></script>
<script type="text/javascript" src="style/js/jNice.js"></script>
<script src="datetimepicker_css.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->
</head>

<body>
<div id="wrapper">
    	<!-- h1 tag stays for the logo, you can use the a tag for linking the index page -->
    	        
        <!-- You can name the links with lowercase, they will be transformed to uppercase by CSS, we prefered to name them with uppercase to have the same effect with disabled stylesheet -->
        <ul id="mainNav">
        	<li><a href="#" class="active">ADMIN</a></li> <!-- Use the "active" class for the active menu item  -->
        	
        	<li class="logout"><a href="login.php">LOGOUT</a></li>
        </ul>
        <!-- // #end mainNav -->
        <div id="containerHolder">
			<div id="container">
       		  <div id="sidebar">
                	<ul class="sideNav">
                    	<li><a href="listnews.php">List News</a></li>
                    	<li><a href="addnews.php">Add News</a></li>
                    	<li><a href="listcar.php">List Cars</a></li>
                    	<li><a href="addcar.php">Add Cars</a></li>
                    	<li><a href="listcompany.php">List Companies</a></li>
                    	<li><a href="addcompany.php">Add Companies</a></li>
                    	<li><a href="listorder.php">Oders</a></li>
                    	<li><a href="listordersubmit.php">Oders submit</a></li>
                    	<li><a href="listcustomer.php">Customers</a></li>
                    </ul>
                    <!-- // .sideNav -->
                </div>    
                <!-- // #sidebar -->
                
                <!-- h2 stays for breadcrumbs -->
                <!-- InstanceBeginEditable name="EditRegion2" -->
                <div id="main">
                <?php
                        if (!isset($_SESSION["AdminID"])){
                            echo("<script>alert('Login, please !');</script>");
                            echo("<script>window.location='login.php';</script>");
                        }else{
                            if($_SESSION["AdminID"] == ''){
                                echo("<script>alert('Dang Nhap, please !');</script>");
                                echo("<script>window.location='login.php';</script>");
                            }
              			}
                    ?>
      <?php
		if(isset($_REQUEST["id"])){
			$id = $_REQUEST["id"];
			$query = mysql_query("select * from ordercar where OrderID=$id");
			while($rs=mysql_fetch_array($query)){
			$carID=$rs['CarID'];
					$sqlCar="Select * from cars where CarID = $carID";
					$reCar=mysql_query($sqlCar);
               	    while($rsCar=mysql_fetch_array($reCar)){
						 $imageCar=$rsCar['Image'];
						 $nameCar=$rsCar['Name'];
						 $timeProduct=$rsCar['TimeProduction'];
						 $contentProduct=$rsCar['Sumary'];
					}
			$perID=$rs['PerID'];
					$sqlPer="Select * from persionorder where PerID = $perID";
					$rePer=mysql_query($sqlPer);
               	    while($rsPer=mysql_fetch_array($rePer)){
						 $perName=$rsPer['Name'];
						 $perEmail = $rsPer['Email'];
						 $perPhone = $rsPer['Phone'];
						 $perAddress = $rsPer['Address'];
					}
			$content=$rs['Content'];
			$status==$rs['Status'];
			$timeOrder=$rs['TimeOrder'];
		?>
    <div style="width:720px; height: 300px;border-bottom: 1px solid #999">
    <div style="width:360px; height: 300px; float:left;">
    <img style="width:360px; height:300px;" src="../images/<?=$imageCar?> " />
    </div>
    <div style="width:360px; height: 300px; margin-left:360px;">
    	<table style="width:98%">
        	<tr><td style="border-bottom:1px solid #999; height:40px;"><span style="font-size:24px; font-weight:bold; margin-left:10px; line-height:40px"><?=$nameCar?></span></td></tr>
            <tr><td style="border-bottom:1px solid #999; height:30px; "><span style="font-size:16px; font-weight:bold; margin-left:10px;line-height:30px;">Time Producttion : <?=$timeProduct?></span></td></tr>
            <tr><td ><span style="font-size:13px;  margin-left:10px;"><?=$contentProduct?></span></td></tr>
        </table>
    </div>
    </div>
    <div style="width:720px; height: 300px;">
    	<div style="width:720px; height: 30px;"> 
    		<span style="font-size:26px; font-weight:bold;  margin-left:260px;line-height:30px">Order Information</span>
        </div>
        <div>
        	<span style="font-size:14px; font-weight:bold;  margin-left:5px;line-height:20px">Customer name: <?=$perName?></span>
        </div>
        <div>
        	<span style="font-size:14px; font-weight:bold;  margin-left:5px;line-height:20px">Phone: <?=$perPhone?></span>
        </div>
        <div>
        	<span style="font-size:14px; font-weight:bold;  margin-left:5px;line-height:20px">Address: <?=$perAddress?></span>
        </div>
        <div>
        	<span style="font-size:14px; font-weight:bold;  margin-left:5px;line-height:20px">Time order: <?=$timeOrder?></span>
        </div>
        <div style="border:1px solid #999; height:185px">
        	<span style="font-size:14px; margin-left:5px;line-height:20px"><?=$content?></span>
        </div>
    </div>
    <div>
    <form action="" method="post" enctype="multipart/form-data" name="formupload" id="formupload">
    	<input type="submit" name="btnSave"  id="btnSave" value="Submit" />
        <input type="reset" name="btnCancel" id="btnCancel" value="Cancel" />
    </form>
    </div>
      <?php
		};
	  ?>
      <?php
		}else{
           echo("<script>window.location='listorder.php'</script>");
		}
	  ?>
      <?php
                     if(isset($_REQUEST["btnSave"])){
						 echo "aaaaaaaaaaa";
						$sqlSubmit = mysql_query("update ordercar set Status='1' where OrderID=$id");
						if($sqlSubmit > 0){
							echo("<script>alert('Submit news success.');window.location='listorder.php';</script>");
						}else{
							echo("<script>window.location='loi.php?loi=suacl'</script>");
						}
					}
      ?>
      
      </div>
                <!-- InstanceEndEditable -->
                <!-- // #main -->
                
              <div class="clear"></div>
            </div>
            <!-- // #container -->
        </div>	
        <!-- // #containerHolder -->
        
        <p id="footer">EPROJECT SEM I - APTECH</p>
    </div>
</body>
<!-- InstanceEnd -->